import xml.etree.ElementTree as ET
import os
import re

labels = set()
p = re.compile(r'(.*)\.')
for i in os.listdir('Annotation'):
    print(i)
    i = p.findall(i)[0]
    xml_file = '/home/zhaoqb/A01/VOC/Annotation/{}.xml'.format(i)
    tree = ET.parse(xml_file)
    root = tree.getroot()

    for obj in root.iter('object'):
        cls = obj.find('name').text
        labels.add(cls)

print(labels)
